#!/bin/bash

echo "tweerminal installer script"
echo "---------------------------"
echo "This script will install tweerminal v0.9 on this machine"
if [[ $EUID -ne 0 ]]
then
  echo "You must be a root user to install tweerminal"
  echo "Try running this script with 'sudo'"
  echo "<Press enter to quit>"
  read
  exit 1
else
  echo "> Starting Intallation . . ."
  if [ -d "tweerminal" ]
  then
    echo "> Copying program files . . ."
    cp -Rf tweerminal/ /opt/
    echo "> Setting English Languaje . . ."
    cp -f /opt/tweerminal/lang/en/* /opt/tweerminal/
    echo "> Removing Extra Files . . ."
    rm -R /opt/tweerminal/lang/
    echo "> Creating shortcut . . ."
    ln -sf /opt/tweerminal/tweerminal.py /usr/bin/tweerminal    
    echo "Installation completed successfully!"
  else
    echo "* Error : tweerminal directory not found . . . Aborting instalation"
  fi
  echo "<Press enter to quit>"
  read
  exit 1
fi
